import request from '@/utils/request'

// 创建数据权限配置
export function createDataPermissionConfig(data) {
  return request({
    url: '/sa/data-permission-config/create',
    method: 'post',
    data: data
  })
}

// 排除继承的数据权限
export function createDataPermissionConfigExclude(data) {
  return request({
    url: '/sa/data-permission-config/exclude/create',
    method: 'post',
    data: data
  })
}

// 更新数据权限配置
export function updateDataPermissionConfig(data) {
  return request({
    url: '/sa/data-permission-config/update',
    method: 'put',
    data: data
  })
}

// 删除数据权限配置
export function deleteDataPermissionConfig(id) {
  return request({
    url: '/sa/data-permission-config/delete?id=' + id,
    method: 'delete'
  })
}


// 取消被排除的数据权限配置
export function deleteDataPermissionConfigExclude(id) {
  return request({
    url: '/sa/data-permission-config/exclude/delete?id=' + id,
    method: 'delete'
  })
}

// 获得数据权限配置
export function getDataPermissionConfig(id) {
  return request({
    url: '/sa/data-permission-config/get?id=' + id,
    method: 'get'
  })
}

// 获得数据权限配置分页
export function getDataPermissionConfigPage(query) {
  return request({
    url: '/sa/data-permission-config/page',
    method: 'get',
    params: query
  })
}

// 导出数据权限配置 Excel
export function exportDataPermissionConfigExcel(query) {
  return request({
    url: '/sa/data-permission-config/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
